home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 1 / CU Amiga Magazine CD-ROM Special Edition (1995)(EMAP Images)(GB)[Issue 1995-11].iso / Aminet / comm / tcp / AmiTCPsdk_40.lha / AmiTCP-4.0 / netinclude / fcntl.h < prev    next >
C/C++ Source or Header  |  1994-10-03  |  2KB  |  81 lines

  1. #ifndef FCNTL_H
  2. #define FCNTL_H \
  3.        "$Id: fcntl.h,v 4.2 1994/10/03 20:52:20 ppessi Exp $"
  4. /*
  5.  *      fcntl.h using AmigaOS 2.04 dos.library 
  6.  *
  7.  *      Copyright © 1994 AmiTCP/IP Group,
  8.  *                       Network Solutions Development, Inc.
  9.  *                       All rights reserved.
  10.  */
  11.  
  12. #ifndef USE_DOSIO
  13. #include <include:fcntl.h>
  14. #else
  15.  
  16. #if __SASC
  17. #ifndef  PROTO_DOS_H
  18. #include <proto/dos.h>
  19. #endif
  20. #elif __GNUC__
  21. #ifndef  _INLINE_DOS_H
  22. #include <inline/dos.h>
  23. #endif
  24. #else
  25. #ifndef  CLIB_DOS_PROTOS_H
  26. #include <clib/dos_protos.h>
  27. #endif
  28. #endif
  29.  
  30. #ifndef DOS_DOS_H
  31. #include <dos/dos.h>
  32. #endif
  33.  
  34. extern BPTR __dosio_files[3];    /* defined in dosio_init.c, autoinitialized */
  35.  
  36. /*
  37.  * level 1 IO is supported for stdio/stdout/stderr only
  38.  */
  39.  
  40. #ifndef _COMMIFMT_H
  41. #include <sys/commifmt.h>
  42. #endif
  43.  
  44. #if 0 /* not supported */
  45. extern int  open   (const char *, int, ...);
  46. extern int  creat  (const char *, int);
  47. #endif
  48.  
  49. #define read(fd, buf, len) \
  50.   (((unsigned)(fd) < 3) ? Read(__dosio_files[(fd)], (buf), (len)) : -1)
  51.  
  52. #define write(fd, buf, len) \
  53.   (((unsigned)(fd) < 3) ? Write(__dosio_files[(fd)], (buf), (len)) : -1)
  54.  
  55. #define lseek(fd, pos, mode) \
  56.   (((unsigned)(fd) < 3) ? Seek(__dosio_files[(fd)], (pos), (mode)-1) : -1)
  57.  
  58.  
  59. #define tell(x)    lseek(x, 0L, 1)
  60.  
  61. #if 0 /* stdin, stdout, stderr should not be closed */
  62. extern int  close  (int);
  63. #endif
  64.  
  65. #define unlink(name) !DeleteFile((STRPTR)(name))
  66.  
  67. #if 0 /* SAS/C iomode() not supported */
  68. extern int  iomode (int, int);
  69. #endif
  70.  
  71. #define isatty(fd) \
  72.   (((unsigned)(fd) < 3) ? IsInteractive(__dosio_files[(fd)]) & 0x1 : 0)
  73.  
  74. #ifndef _COMMNULL_H
  75. #include <sys/commnull.h>
  76. #endif
  77.  
  78. #endif /* USE_DOSIO */
  79.  
  80. #endif /* FCNTL_H */
  81.